/*
 * TccUserAS.java
 * 
 * Created on 08/09/2007, 19:00:36
 * 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tcc.applicationService.tccsystemuser;

import java.util.List;
import tcc.applicationService.AbstractAS;
import tcc.dao.login.TCCSystemUserDAO;
import tcc.domain.login.TCCSystemUser;
import tcc.exception.system.TccASException;

/**
 *
 * @author Diego
 */
public class TccUserAS extends AbstractAS{
    private static TccUserAS instance;
    
    public static synchronized TccUserAS getInstance(){
        if (instance == null ){
            instance = new TccUserAS();
        }
        return instance;
    }
    
    public void criarFuncionario(TCCSystemUser funcionario)throws TccASException{
        new TCCSystemUserDAO().save(funcionario);
    }
    
    public  void removerFuncionanrio(TCCSystemUser funcionario)throws TccASException{
        new TCCSystemUserDAO().delete(funcionario);
    }
    
    public List<TCCSystemUser> listarFuncionarios() throws TccASException{
        try{
            return new TCCSystemUserDAO().findAll();
        }catch(Exception ex){
            throw new TccASException(ex);
        }
    }
}
